package com.hj.javase;

/**
 * @Author : hujing
 * @Date: 2025/7/30 13:49
 * @Description:
 * 设计一个不可变的类
 * 类型声明为final,字段私有且不可变，只提供get方法
 */
public final class ImmutableClass {
    
    private final String name;
    private final int age;
    
    public ImmutableClass(String name,int age){
        this.name = name;
        this.age = age;
    }
    
    public String getName(){
        return name;
    }
    
    public int getAge(){
        return age;
    }
}
